const cloud = require("@cloudbase/node-sdk");

const app = cloud.init({
    env: cloud.SYMBOL_CURRENT_ENV,
});

var db = app.database();
const _ = db.command
const AION_ZB_WQ = db.collection('AION-ZB-WQ')
const AION_ZB_FJ = db.collection('AION-ZB-FJ')
const AION_ZB_SP = db.collection('AION-ZB-SP')

// 获取openId云函数入口函数
exports.main = async (event, context) => {

    // return await AION_ZB_WQ.get()
    var cType = event.cType
    var _id = event.data._id

    if(cType==1){
        return await AION_ZB_WQ.doc(_id).get()
    }else if(cType==2){
        return await AION_ZB_FJ.doc(_id).get()
    }else if(cType==3){
        return await AION_ZB_SP.doc(_id).get()
    }
    
};
